<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>搜事网-用户组管理</title>
<!-- 引用文件:start-->
<jsp:include page="includes.jsp" />
<%@ page language="java" contentType="text/html;charset=UTF-8"
	import="java.util.*" pageEncoding="utf-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<!-- 引用文件:end-->
</head>
<body>
	<div class="wrap">
		<!-- header:start -->
		<jsp:include page="banner.jsp" />
		<!-- header:end -->
		<div id="body">
			<div id="left" class="wrap">
				<h1 class="page">
					<span>用户组管理</span>
				</h1>
				<div class="main lside176">
					<jsp:include page="left_banner.jsp" />
					<div class="middle w804">
						<div id="left" class="w804">
							<div class="main">
								<div class="topbox">
									<div class="tabs">
										<a href="listUser.do"><span>用户管理</span></a> <a
											href="listUserGroup.do"><span>用户组管理</span></a>
									</div>
								</div>
								<div class="tabContent">
									<div class="listForm">
										<form action="deleteUserGroup.do" name="delForm" method="post">

											<button class="btn modify" type="button"
												onclick="newUserGroup()">新建</button>
											<button name="delselect" class="btn delete" type="submit"
												onclick="document.delForm.submit()">删除</button>
											<s:if test="userGroups.size">
												<table class="t" width="100%" cellspacing="1">
													<tr class="odd">
														<td></td>
														<td>用户组名</td>
														<td>角色</td>
													</tr>
													<s:iterator value="userGroups">
														<tr>
															<td><input type="checkbox" name="delIds"
																value="${id}" /></td>
															<td><s:property value="name" /></td>
															<td><s:if test="role=='admin'">管理员</s:if> <s:if
																	test="role=='user'">普通用户</s:if></td>

														</tr>
													</s:iterator>
												</table>
											</s:if>
										</form>
										<!-- 分页:start -->
										<!-- 分页:end -->
										<script>
											function newUserGroup() {
												document
														.getElementById("myForm").style.display = "block";
											}
											function saveUserGroup() {
												document.getElementById(
														'myForm').submit();
											}
										</script>

										<form id="myForm" action="saveUserGroup.do" method="post"
											style="display: none">
											<table>
												<tr>
													<td>用户组名</td>
													<td><input type="text" name="name" /></td>
												</tr>
												<tr>
													<td>角色</td>
													<td><select name="role">
															<option value="user">普通用户</option>
															<option value="admin">管理员</option>
													</select></td>
												</tr>
											</table>
											<input type="button" onclick="saveUserGroup()" value="新建" />
										</form>

									</div>
								</div>
							</div>
						</div>
					</div>
					<jsp:include page="footer.jsp" />
					<div class="clear"></div>
				</div>
			</div>
		</div>
	</div>
</body>
</html>
